package com.starmark.core.framework.response;

/**
 * 错误异常返回
 *
 * @author starmark
 * <p>
 * 2018年12月26日
 */
public class ErrorResponseData extends Response {

    private String stackMsg;

    private ErrorResponseData(IHttpCode code, String msg, String stackMsg) {
        super(code, msg);

        this.stackMsg = stackMsg;
    }

    public ErrorResponseData() {
        super(HttpCode.INTERNAL_SERVER_ERROR);
    }

    public static ErrorResponseData newInstance(String msg) {
        return new ErrorResponseData(HttpCode.INTERNAL_SERVER_ERROR, msg, msg);
    }

    public static ErrorResponseData newInstance(IHttpCode code) {
        return new ErrorResponseData(code, code.msg(), null);
    }


    public static ErrorResponseData newInstance(IHttpCode code, String msg) {
        return new ErrorResponseData(code, msg, null);
    }

    private static ErrorResponseData newInstance(IHttpCode code, String msg, String stackMsg) {
        return new ErrorResponseData(code, msg, stackMsg);
    }

    public String getStackMsg() {
        return stackMsg;
    }

    public void setStackMsg(String stackMsg) {
        this.stackMsg = stackMsg;
    }

}